package com.ljs.control
{
	import com.ljs.manager.NetManager;
	import com.ljs.manager.SceneManager;
	import com.ljs.net.Packet;
	import com.ljs.staticPool.StaticWorldPool;
	import com.ljs.view.panel.LoginPanel;
	import com.ljs.view.panel.SelectRolePanel;
	
	import flash.display.MovieClip;

	public class MainControl extends MovieClip
	{
		private var _login:LoginPanel;
		private var _selectRole:SelectRolePanel;
		private var _scene:SceneManager;
		private var _content:MainContent;
		public function MainControl()
		{
			init();
		}
		
		private function init()
		{
			stage.frameRate=10;
			_content=new MainContent();
			_login=new LoginPanel();
			addChild(_login);
			_login.setControl(this);
			_login.setContent(_content);
			_scene=new SceneManager();
			_scene.setContent(_content);
			addChild(_scene);
		}
	
		public function sendPacket()
		{
			removeChild(_login);
			_login=null;
			_selectRole=new SelectRolePanel();
			_selectRole.setControl(this);
			_selectRole.setDataPool(_content);
			addChild(_selectRole);
		}
		
		public function gotoGame()
		{
			if(_selectRole&&this.contains(_selectRole))
			{
				_selectRole.destroy();
				removeChild(_selectRole);
				_selectRole=null;
			}
			_content.worldVo=StaticWorldPool.getInstance().getWorldDataById(1);
			_scene.start();
		}
	}
}